package com.lengxf.pay.ali.starter;

import cn.hutool.json.JSONUtil;
import com.lengxf.pay.ali.ALI_PayService;
import com.lengxf.pay.ali.config.ALI_PayConfig;
import com.lengxf.pay.common.enums.PayChannel;
import com.lengxf.pay.common.service.BasePayService;
import com.lengxf.pay.starter.parent.pay.PayServiceRegister;
import org.springframework.stereotype.Service;

@Service
public class AliPayServiceRegister implements PayServiceRegister {
    @Override
    public PayChannel payChannel() {
        return PayChannel.ALI;
    }

    @Override
    public BasePayService payService(String payConfig) {
        ALI_PayConfig config = JSONUtil.toBean(payConfig, ALI_PayConfig.class);
        return new ALI_PayService(config);
    }

}
